const { Transform } = require('stream');
const Mustache = require('./mustache');

class RenderTransform extends Transform {
  constructor(config) {
    super();
    this._config = config;
  }

  _transform (data, encoding, callback) {
    callback(null, Mustache.render(data.toString(), this._config));
  }
}

module.exports = RenderTransform;